import request from '@/utils/request'

// 查询生产任务列表
export function listProtask(query) {
  return request({
    url: '/mes/pro/protask/list',
    method: 'get',
    params: query
  })
}

// 查询生产任务列表
export function listGanttTaskList(query) {
  return request({
    url: '/mes/pro/protask/listGanttTaskList',
    method: 'get',
    params: query
  })
}

// 查询生产任务列表
export function listTaskListByWorkorder(query) {
  return request({
    url: '/mes/pro/protask/listTaskListByWorkorder',
    method: 'get',
    params: query
  })
}


// 查询生产任务详细
export function getProtask(taskId) {
  return request({
    url: '/mes/pro/protask/' + taskId,
    method: 'get'
  })
}

// 新增生产任务
export function addProtask(data) {
  return request({
    url: '/mes/pro/protask',
    method: 'post',
    data: data
  })
}

// 修改生产任务
export function updateProtask(data) {
  return request({
    url: '/mes/pro/protask',
    method: 'put',
    data: data
  })
}

// 删除生产任务
export function delProtask(taskId) {
  return request({
    url: '/mes/pro/protask/' + taskId,
    method: 'delete'
  })
}
// 查询工单任务列表
export function listProtaskVo(query) {
  return request({
    url: '/mes/pro/protask/taskVoList',
    method: 'get',
    params: query
  })
}
// 开工
export function start(data) {
  return request({
    url: '/mes/pro/protask/start',
    method: 'put',
    data: data
  })
}
// 完工
export function finish(data) {
  return request({
    url: '/mes/pro/protask/end',
    method: 'put',
    data: data
  })
}
// 获取工单任务详情
export function getTaskInfo(taskId) {
  return request({
    url: '/mes/pro/protask/taskInfo/'+taskId,
    method: 'get',

  })
}

export function getFirstCheck(taskId) {
  return request({
    url: '/mes/pro/protask/getFirstCheck/'+taskId,
    method: 'get',
  })
}

// 完工
export function cancel(data) {
  return request({
    url: '/mes/pro/protask/cancel',
    method: 'put',
    data: data
  })
}

// 查询生产任务列表
export function listProTaskNew(query) {
  return request({
    url: '/mes/pro/protask/list2',
    method: 'get',
    params: query
  })
}

// 完工
export function died(data) {
  return request({
    url: '/mes/pro/protask/died',
    method: 'put',
    data: data
  })
}

// 开工
export function restart(data) {
  return request({
    url: '/mes/pro/protask/restart',
    method: 'put',
    data: data
  })
}


// 开工
export function restart2(data) {
  return request({
    url: '/mes/pro/protask/restart2',
    method: 'put',
    data: data
  })
}

// 查询生产任务列表
export function mergeList(query) {
  return request({
    url: '/mes/pro/protask/mergeList',
    method: 'get',
    params: query
  })
}

